import 'package:flutter/material.dart';
import 'package:frontend/pages/homePage.dart';
import 'package:frontend/states/NetState.dart';
import 'package:frontend/states/cartState.dart';
import 'package:frontend/states/userState.dart';
import 'package:provider/provider.dart';

void main() {
  runApp(
    MultiProvider(providers: [
      ChangeNotifierProvider(create: (context) => UserState()),
      //ChangeNotifierProvider(create: (context) => CartState()),
      ChangeNotifierProvider(create: (context) => NetState()),
    ], child: MyApp()),
  );
}

class MyApp extends StatefulWidget {
  MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'lazy cat',
      /*theme: ThemeData(
        primarySwatch: Colors.blueGrey,
      ),*/
      theme: Provider.of<UserState>(context).isDark
          ? ThemeData.dark(useMaterial3: true)
          : ThemeData(
              primarySwatch: Colors.blueGrey,
            ),
      home: const MyHomePage(title: 'lazy cat'),
    );
  }
}
